import {postJson, get} from "./request";

export const roleHttp = {

  get: function (roleId) {
    let  params =  {
      url: '/role',
      data: {
        'roleId': roleId,
      }
    }
    return get(params)
  },


  list: function (role) {
    let  params = {
      url: '/role/list',
      data: role
    }
    return get(params)
  },

  listPage: function (pageNum,pageSize) {
    let  params =  {
      url: '/role/list',
      data: {
        'pageNum': pageNum,
        'pageSize': pageSize
      }
    }
    return get(params)
  },

  /*
  角色添加
 */
  add: function (role) {
    let  params =  {
      url: '/role/add',
      data: {
        'roleName': role.roleName,
        'roleKey': role.roleKey,
        'remark': role.remark,
      }
    }
    return postJson(params)
  },


  /*
    角色删除
   */
  del: function (roleId) {
    let  params =  {
      url: '/role/del',
      data: {
        'roleId': roleId
      }
    }
    return postJson(params)
  },


  /*
    角色修改
   */
  edit: function (role) {
    let  params =  {
      url: '/role/edit',
      data: {
        'roleId': role.roleId,
        'roleName': role.roleName,
        'roleKey': role.roleKey,
      }
    }
    return postJson(params)
  },

  /*
    角色授权
   */
  auth: function (role) {
    let  params =  {
      url: '/role/auth',
      data: {
        'roleId': role.roleId,
        'menuIdList': role.menuIdList
      }
    }
    return postJson(params)
  },

}



